import { stringify } from "qs";
import request from "@/utils/request";

export async function listRole(params) {
  return request(`/api/account/accRole/?${stringify(params)}`);
}

export async function listPermsByRoleId(params) {
  return request(`/api/account/accRole/listPermsByRoleId/?${stringify(params)}`);
}

export async function listAllRole() {
  return request("/api/account/accRole/listAll");
}

export async function createRole(params) {
  return request("/api/account/accRole/create", {
    method: "POST",
    body: {
      ...params
    }
  });
}

export async function updateRole(params) {
  return request("/api/account/accRole/update", {
    method: "POST",
    body: {
      ...params
    }
  });
}

export async function deleteRole(params) {
  return request(`/api/account/accRole/delete/${params.id}`);
}
